package com.mz361.modules.system.repository;

import com.mz361.modules.system.domain.OrderUser;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @author liaomch
 * @ date 2024/05/07
 */
public interface OrderUserRepository extends BaseRepository<OrderUser, Long> {
    @Query(value = "from OrderUser o where o.status<>3 and o.companyId=?1")
    List<OrderUser> findAllByCompanyId(Long companyId);

    @Query(value = "from OrderUser o where o.status<>3 and o.memeberId=?1")
    List<OrderUser> findAllByMemeberId(Long memeberId);

    @Query(value = "from OrderUser o where o.status<>3 and o.companyId=?1 and o.serviceName=?2")
    List<OrderUser> findAllByCompanyIdAndServiceName(Long companyId, String serviceName);

    @Query(value = "from OrderUser o where o.status<>3 and o.memeberId=?1 and o.serviceName=?2")
    List<OrderUser> findAllByMemberIdAndServiceName(Long memeberId, String serviceName);

    @Query(value = "from OrderUser o where o.status<>3 and o.companyId=?1 and o.packageId=?2")
    List<OrderUser> findALLByCAndCompanyIdAndAndPackageId(Long companyId, Long packageId);

    @Query(value = "from OrderUser o where o.status<>3 and o.memeberId=?1 and o.packageId=?2")
    List<OrderUser> findALLByCAndMemeberIdAndPackageId(Long memeberId, Long packageId);
}